#include "InputPanel.h"

#define PADSTAT 0x1E0
#define PADIER 0x1E1

InputPanelListener UserListener = 0; //whatever null is for function pointers.

_Interrupt1 void ButtonPanelHandler()
{
	union InputPanelButtons buttonsPressed;
	buttonsPressed.ButtonRegister = _lr(PADSTAT);
	UserListener(buttonsPressed);
}

void setInputPanelListener(InputPanelListener listener)
{
	UserListener = listener;
}

void enableInputPanelInterrupts(union InputPanelButtons buttonsEnabled)
{
	_sr(buttonsEnabled.ButtonRegister,PADIER);
}
